export default {

    // 更新音乐url
    updateMusicId(state, musicId) {
        state.musicId = musicId;
        console.log('updateMusicId');
    },
    // 修改播放状态
    changePlayState(state, isPlay) {
        state.isPlay = isPlay;
        console.log('changePlayState');
    },
    // 更新歌单列表和歌单id
    updateMusicList(state, payload) {
        // 当歌单id发生变化时,重置当前播放音乐索引
        if (payload.musicListId != state.musicListId) {
            state.musicListId = payload.musicListId;
            state.currentIndex = -1;
        }
        console.log(state.currentIndex);
        // 对歌单进行深拷贝再赋值 直接赋值是浅拷贝
        // 歌单是固定的死数据，而vuex中的musicList是动态的
        let musicList = payload.musicList.slice(0)
        state.musicList = musicList;
        console.log('updateMusicList');
    },

    //更新登录状态
    updataLoginState(state) {
        state.isLogin = !state.isLogin;
    },
    // 当前播放音乐的索引
    updateCurrentIndex(state, index) {
        console.log('updateCurrentIndex');
        state.currentIndex = index;
        console.log(state.currentIndex);
    },
    // 切换音乐详情卡片的显隐
    changeMusicDetailCardState(state) {
        state.isMusicDetailCardShow = !state.isMusicDetailCardShow;
    },
    updateCurrentTime(state, currentTime) {
        state.currentTime = currentTime;
    },
    // 更新音乐的加载状态
    updateMusicLoadState(state, isLoad) {
        state.isMusicLoad = isLoad;
    },
    // 用于记录当前播放行的信息 便于下次渲染和清除播放样式
    updateCurrentRowInfo(state, currentRowInfo) {
        state.currentRowInfo = currentRowInfo;
    },
    // 更新用户喜欢的音乐列表
    // 才发现这里拼错了 懒得改了
    updataLikeMuiscList(state, likeMuiscList) {
        state.likeMuiscList = likeMuiscList;
    },
    // 更新已收藏的专辑列表
    updateSubAlbumList(state, subAlbumList) {
        state.subAlbumList = subAlbumList;
    },
    // 更新已收藏的歌手列表
    updateSubSingerList(state, subSingerList) {
        state.subSingerList = subSingerList;
    },
    // 更新已收藏的视频列表
    updateSubVideoList(state, subVideoList) {
        state.subVideoList = subVideoList;
    },
    // 更新已收藏的歌单
    updateCollectMusicList(state, collectMusicList) {
        state.collectMusicList = collectMusicList;
    },
    // 更新用户创建的歌单
    updateCreatedMusicList(state, createdMusicList) {
        state.createdMusicList = createdMusicList;
    },
    // 更新当前下载的音乐信息
    updateDownloadMusicInfo(state, info) {
        state.downloadMusicInfo = info;
    },
    // 更新已喜欢的视频列表
    updateLikeVideoList(state, likeVideoList) {
        state.likeVideoList = likeVideoList;
    },
}